// pages/author/author.js

const app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    btn: [],
    patbtn: [],
    imgheight: [],
    paint:[],
    btnheight: [],
    text: [],
    btnClick: [],
    aInfo: ""
  },

  linliang1: function(){
    wx.navigateTo({
      url: "/pages/detail/detail?pId=20"
    });
  },
  linliang2: function(){
    wx.navigateTo({
      url: "/pages/detail/detail?pId=21"
    });
  },
  shenzhou1: function(){
    wx.navigateTo({
      url: "/pages/detail/detail?pId=25"
    })
  },
  shenzhou2: function(){
    wx.navigateTo({
      url: "/pages/detail/detail?pId=26"
    })
  },
  huangquan1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=15',
    })
  },
  huangquan2: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=16',
    })
  },
  huangquan3: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=17',
    })
  },
  qiuying1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=9',
    })
  },
  qiuying2: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=10',
    })
  },
  zhangxuan1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=5',
    })
  },
  lvji1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=6',
    })
  },
  lvji2: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=14',
    })
  },
  zhoufang1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=8',
    })
  },
  zhuda1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=11',
    })
  },
  zhuda2: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=12',
    })
  },
  liangkai1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=13',
    })
  },
  gaoyan1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=22',
    })
  },
  jvchao1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=23',
    })
  },
  xvxi1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=24',
    })
  },
  wenhuiming1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=27',
    })
  },
  wenhuiming2: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=28',
    })
  },
  wangmeng1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=30',
    })
  },
  wuzhen1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=31',
    })
  },
  nizan1: function(){
    wx.navigateTo({
      url: '/pages/detail/detail?pId=32',
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var from = options.from;
    var paints = [];
    var patBtn = [];
    var imgHeight = [];
    var btnHeight = [];
    var Btn=[];
    console.log(from)
    if(from == "linliang"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=林良`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<2){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<2; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["linliang1", "linliang2"]
          })
        }
      })
    }else if(from == "shenzhou"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=沈周`,
        success: res=>{
          console.log(res.data.data.aInfo)
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<2){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<2; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick:["shenzhou1","shenzhou2"]
          })
        }
      })
    }else if(from == "huangquan"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=黄筌`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<3){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<3; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["huangquan1", "huangquan2", "huangquan3"]
          })
        }
      })
    }else if(from == "qiuying"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=仇英`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<2){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<2; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["qiuying1", "qiuying2"]
          })
        }
      })
    }else if(from == "zhangxuan"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=张萱`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["zhangxuan1"]
          })
        }
      })
    }else if(from == "lvji"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=吕纪`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<2){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<2; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["lvji1", "lvji2"]
          })
        }
      })
    }else if(from == "zhoufang"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=周昉`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["zhoufang1"]
          })
        }
      })
    }else if(from == "zhuda"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=朱耷`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<2){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<2; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick:["zhuda1", "zhuda2"]
          })
        }
      })
    }else if(from == "liangkai"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=梁楷`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["liangkai1"]
          })
        }
      })
    }else if(from == "gaoyan"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=高俨`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("650rpx");
            btnHeight.push("650rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick:["gaoyan1"]
          })
        }
      })
    }else if(from == "jvchao"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=居巢`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("800rpx");
            btnHeight.push("800rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["gaoyan1"]
          })
        }
      })
    }else if(from == "xvxi"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=徐熙`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("750rpx");
            btnHeight.push("750rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["xvxi1"]
          })
        }
      })
    }else if(from == "wenhuiming"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=文徵明`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<2){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<2; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["wenhuiming1", "wenhuiming2"]
          })
        }
      })
    }else if(from == "huanggongwang"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=黄公望`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("400rpx");
            btnHeight.push("400rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick:["huanggongwang1"]
          })
        }
      })
    }else if(from == "wangmeng"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=王蒙`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("700rpx");
            btnHeight.push("700rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["wangmeng1"]
          })
        }
      })
    }else if(from == "wuzhen"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=吴镇`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("700rpx");
            btnHeight.push("700rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["wuzhen1"]
          })
        }
      })
    }else if(from == "nizan"){
      wx.request({
        url: `${app.globalData.url}/author/?aName=倪瓒`,
        success: res=>{
          var arr = res.data.data.pId;
          for(var i=0; i<arr.length; i++){
            paints.push(`${app.globalData.url}/pContent/?pId=${arr[i].pId}`);
          }
          for(var i=0; i<3;i++){
            if(i<1){
              patBtn.push("block");
              Btn.push("flex");
            }else{
              patBtn.push("none");
              Btn.push("none")
            }
          }
          for(var i=0; i<1; i++){
            imgHeight.push("1800rpx");
            btnHeight.push("1800rpx");
          }
          this.setData({
            paint: paints,
            patbtn: patBtn,
            btn: Btn,
            imgheight:imgHeight,
            btnheight: btnHeight,
            aInfo: res.data.data.aInfo,
            btnClick: ["nizan1"]
          })
        }
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})